package net.sareweb.acab.entity;

// Generated 30-mar-2010 19:37:37 by Hibernate Tools 3.2.5.Beta

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;
import org.jboss.seam.annotations.security.management.UserEnabled;
import org.jboss.seam.annotations.security.management.UserFirstName;
import org.jboss.seam.annotations.security.management.UserLastName;
import org.jboss.seam.annotations.security.management.UserPassword;
import org.jboss.seam.annotations.security.management.UserPrincipal;

/**
 * User generated by hbm2java
 */
@Entity
@Table(name = "user", catalog = "acab")
public class User implements java.io.Serializable {

	private Integer idUser;
	private String login;
	private String password;
	private String name;
	private String surname;
	private Date birthDate;
	private Date createDate;
	private Date modifyDate;
	private Date deleteDate;
	private String type;
	private int calculatedRate;
	private boolean enabled;
	private Set<Commentonsuggestion> commentonsuggestions = new HashSet<Commentonsuggestion>(
			0);
	private Set<Role> roles = new HashSet<Role>(0);
	private Set<Seat> seats = new HashSet<Seat>(0);
	private Set<Request> requests = new HashSet<Request>(0);
	private Set<Dialog> dialogs = new HashSet<Dialog>(0);
	private Set<Evaluation> evaluations = new HashSet<Evaluation>(0);
	private Set<Travel> travels = new HashSet<Travel>(0);
	private Set<Avatar> avatars = new HashSet<Avatar>(0);
	private Set<Comment> comments = new HashSet<Comment>(0);
	private Set<Match> matchs = new HashSet<Match>(0);

	public User() {
	}

	public User(String login, String password, String name, String surname,
			Date birthDate, Date createDate, String type, int calculatedRate,
			boolean enabled) {
		this.login = login;
		this.password = password;
		this.name = name;
		this.surname = surname;
		this.birthDate = birthDate;
		this.createDate = createDate;
		this.type = type;
		this.calculatedRate = calculatedRate;
		this.enabled = enabled;
	}

	public User(String login, String password, String name, String surname,
			Date birthDate, Date createDate, Date modifyDate, Date deleteDate,
			String type, int calculatedRate, boolean enabled,
			Set<Commentonsuggestion> commentonsuggestions, Set<Role> roles,
			Set<Seat> seats, Set<Request> requests, Set<Dialog> dialogs,
			Set<Evaluation> evaluations, Set<Travel> travels,
			Set<Avatar> avatars, Set<Comment> comments, Set<Match> matchs) {
		this.login = login;
		this.password = password;
		this.name = name;
		this.surname = surname;
		this.birthDate = birthDate;
		this.createDate = createDate;
		this.modifyDate = modifyDate;
		this.deleteDate = deleteDate;
		this.type = type;
		this.calculatedRate = calculatedRate;
		this.enabled = enabled;
		this.commentonsuggestions = commentonsuggestions;
		this.roles = roles;
		this.seats = seats;
		this.requests = requests;
		this.dialogs = dialogs;
		this.evaluations = evaluations;
		this.travels = travels;
		this.avatars = avatars;
		this.comments = comments;
		this.matchs = matchs;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "idUser", unique = true, nullable = false)
	public Integer getIdUser() {
		return this.idUser;
	}

	public void setIdUser(Integer idUser) {
		this.idUser = idUser;
	}

	@Column(name = "login", nullable = false, length = 45)
	@NotNull
	@Length(max = 45)
	@UserPrincipal
	public String getLogin() {
		return this.login;
	}

	public void setLogin(String login) {
		this.login = login;
	}

	@Column(name = "password", nullable = false, length = 45)
	@NotNull
	@Length(max = 45)
	@UserPassword(hash="sha")
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name = "name", nullable = false, length = 45)
	@NotNull
	@Length(max = 45)
	@UserFirstName
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "surname", nullable = false, length = 45)
	@NotNull
	@Length(max = 45)
	@UserLastName
	public String getSurname() {
		return this.surname;
	}

	public void setSurname(String surname) {
		this.surname = surname;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "birthDate", nullable = false, length = 0)
	@NotNull
	public Date getBirthDate() {
		return this.birthDate;
	}

	public void setBirthDate(Date birthDate) {
		this.birthDate = birthDate;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "createDate", nullable = false, length = 0)
	@NotNull
	public Date getCreateDate() {
		return this.createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "modifyDate", length = 0)
	public Date getModifyDate() {
		return this.modifyDate;
	}

	public void setModifyDate(Date modifyDate) {
		this.modifyDate = modifyDate;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "deleteDate", length = 0)
	public Date getDeleteDate() {
		return this.deleteDate;
	}

	public void setDeleteDate(Date deleteDate) {
		this.deleteDate = deleteDate;
	}

	@Column(name = "type", nullable = false, length = 10)
	@NotNull
	@Length(max = 10)
	public String getType() {
		return this.type;
	}

	public void setType(String type) {
		this.type = type;
	}

	@Column(name = "calculatedRate", nullable = false)
	public int getCalculatedRate() {
		return this.calculatedRate;
	}

	public void setCalculatedRate(int calculatedRate) {
		this.calculatedRate = calculatedRate;
	}

	@Column(name = "enabled", nullable = false)
	public boolean isEnabled() {
		return this.enabled;
	}

	public void setEnabled(boolean enabled) {
		this.enabled = enabled;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
	public Set<Commentonsuggestion> getCommentonsuggestions() {
		return this.commentonsuggestions;
	}

	public void setCommentonsuggestions(
			Set<Commentonsuggestion> commentonsuggestions) {
		this.commentonsuggestions = commentonsuggestions;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "user_has_role", catalog = "acab", joinColumns = { @JoinColumn(name = "User_idUser", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "Role_idRole", nullable = false, updatable = false) })
	public Set<Role> getRoles() {
		return this.roles;
	}

	public void setRoles(Set<Role> roles) {
		this.roles = roles;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
	public Set<Seat> getSeats() {
		return this.seats;
	}

	public void setSeats(Set<Seat> seats) {
		this.seats = seats;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
	public Set<Request> getRequests() {
		return this.requests;
	}

	public void setRequests(Set<Request> requests) {
		this.requests = requests;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
	public Set<Dialog> getDialogs() {
		return this.dialogs;
	}

	public void setDialogs(Set<Dialog> dialogs) {
		this.dialogs = dialogs;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
	public Set<Evaluation> getEvaluations() {
		return this.evaluations;
	}

	public void setEvaluations(Set<Evaluation> evaluations) {
		this.evaluations = evaluations;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
	public Set<Travel> getTravels() {
		return this.travels;
	}

	public void setTravels(Set<Travel> travels) {
		this.travels = travels;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
	public Set<Avatar> getAvatars() {
		return this.avatars;
	}

	public void setAvatars(Set<Avatar> avatars) {
		this.avatars = avatars;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
	public Set<Comment> getComments() {
		return this.comments;
	}

	public void setComments(Set<Comment> comments) {
		this.comments = comments;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
	public Set<Match> getMatchs() {
		return this.matchs;
	}

	public void setMatchs(Set<Match> matchs) {
		this.matchs = matchs;
	}

}
